package com.example.estest;

import com.example.estest.watch.FileWatcher;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.PropertySource;

@SpringBootApplication
@PropertySource("classpath:application.properties")
public class EsTestApplication {
    @Autowired
    public FileWatcher fileWatcher;

    @Value("${logpath}")
    public String logpath;


    @Value("${listeningfilepath}")
    public String listeningfilepath;

    @Resource
    public RestHighLevelClient client;


    @PostConstruct
    public void initStart() {
        fileWatcher.func(logpath,client,listeningfilepath);
    }



    public static void main(String[] args) {
        SpringApplication.run(EsTestApplication.class, args);
    }

}
